Skip to content

Rule: 'no-static-styles-assignment' #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

saberzero1
Copy link
Contributor

closes #9

  • Adds the no-static-styles-assignment rule. It validates the following:
    • Allowed:
      • element.style.width = myWidth; (assignment from a variable)
      • element.style.transform = `translateX(${offset}px);` (assignment from a template literal with expressions)
    • Not allowed:
      • element.style.color = 'red'
      • element.style.setProperty('color', 'red')
      • element.style.cssText = 'color: red;'
      • element.setAttribute('style', 'color: red;')

@saberzero1 saberzero1 marked this pull request as ready for review June 6, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule: Static styles should not be assigned from JS/TS
2 participants